/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import dominio.Rol;
import fachada.RolDAO;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;

/**
 *
 * @author rodrifonsi
 */
@ManagedBean(name = "rolController")
@SessionScoped
public class RolController implements Serializable {

    @EJB
    RolDAO rolDAO;
 
    /** Creates a new instance of RolController */
    public RolController() {
    }

    public SelectItem[] getRolSet() {
        List<Rol> lr = rolDAO.getAllRol();
        int size = lr.size();
        SelectItem[] items = new SelectItem[size];
        int i = 0;
        for (Rol x : lr) {
            items[i++] = new SelectItem(x.getId(), x.toString());
        }
        return items;

    }
}
